 gemenu=6;
 

                      SndPlay(sndc1,click,TRUE);
                      do ; while(SndChannelBusy(sndc1)==true); 

                  SetPort((GrafPtr) firstWin);
               	  SetRect(&re,0,40,640,440);
				  FillCRect(&re,leers);

			              SetRect(&rec,161,0,504,480);
                                                 apple=GetPicture(144);
                                                 HUnlock((Handle) apple);
                                                 DrawPicture(apple,&rec);               
                                                 ReleaseResource((Handle) apple);  

 
  
 nwi=0;
 nz1=0;
 nz2=0;
 nz3=0;
for (i=0;i<=10;++i)
 {
 coden[i]=' ';           
 codet[i]=' ';           
 codel[i]=' ';
 tame[i]=' ';
  };
 
 lx=nz1;
 wox=163+20;
 timey=nx1;
 nwi=1;
 
 nz1=0;
 nz2=0;
 nz3=0;
 
 bl=0;
 blz=0;

 do { 

if (nwi==1) {
 blx=163+20+30+lx*25;
 bly=nx1; };
if (nwi==2) {
 blx=163+20+30+lx*25;
 bly=nx2; };
if (nwi==3) {
 blx=163+20+30+lx*25;
 bly=nx3; };
  
                SetRect(&ref,blx,bly,blx+25,bly+25);
                if (bl==0) ic0=GetCIcon(154);  
                if (bl==1) ic0=GetCIcon(155);    
                if (ic0!=0L) {
                  PlotCIcon(&ref,ic0); 
                DisposeCIcon(ic0); };   
                    
  ++blz;
  if (blz>10) blz=0;
  if (blz==0) {
    if (bl==1) bl=0;  else   bl=1;
  };
  
  SetPort((GrafPtr) firstWin);

 
      GetMouse(&mousepix);
         q=mousepix.h;
         qq=mousepix.v;  /* nur x- Achse !! */
         

 
                 c=12;
                 GetKeys(theKeys);
                 if (BitTst(&theKeys,7)==true) { c='A';   };

                 if (BitTst(&theKeys,12)==true){ c='B'; };
                 if (BitTst(&theKeys,15)==true) {c='C';  };
                 if (BitTst(&theKeys,5)==true){ c='D';  };
                 if (BitTst(&theKeys,9)==true){ c='E'; };
                 if (BitTst(&theKeys,4)==true) {c='F';  };
                 if (BitTst(&theKeys,2)==true) {c='G';  };
                 if (BitTst(&theKeys,3)==true) {c='H'; };

                 if (BitTst(&theKeys,37)==true) {c='I';  };
                 if (BitTst(&theKeys,33)==true){ c='J';  };
                 if (BitTst(&theKeys,47)==true){ c='K';  };
                 if (BitTst(&theKeys,34)==true) {c='L';  };

                 if (BitTst(&theKeys,41)==true) {c='M';  };
                 if (BitTst(&theKeys,42)==true) {c='N';  };
                 if (BitTst(&theKeys,24)==true) {c='O';  };
                 if (BitTst(&theKeys,36)==true) {c='P';  };
                 if (BitTst(&theKeys,11)==true) {c='Q';  };
                 if (BitTst(&theKeys,8)==true) {c='R';  };
                 if (BitTst(&theKeys,6)==true) {c='S';  };
                 if (BitTst(&theKeys,22)==true) {c='T';  };

                 if (BitTst(&theKeys,39)==true) {c='U';  };
 
                 if (BitTst(&theKeys,14)==true) {c='V';  };
                 if (BitTst(&theKeys,10)==true) {c='W';  };
                 if (BitTst(&theKeys,0)==true) {c='X';  };

                 if (BitTst(&theKeys,1)==true){ c='Y';  };

                 if (BitTst(&theKeys,23)==true) {c='Z';  };

                 if (BitTst(&theKeys,54)==true){ c=' ';  }; 

                 if (BitTst(&theKeys,85)==true) {c='0';  };
                 if (BitTst(&theKeys,84)==true) {c='1';  };
                 if (BitTst(&theKeys,83)==true) {c='2';  };
                 if (BitTst(&theKeys,82)==true) {c='3';  };
                 if (BitTst(&theKeys,81)==true) {c='4';  };
                 if (BitTst(&theKeys,80)==true) {c='5';  };
                 if (BitTst(&theKeys,95)==true) {c='6';  };
                 if (BitTst(&theKeys,94)==true) {c='7';  };
                 if (BitTst(&theKeys,92)==true) {c='8';  };
                 if (BitTst(&theKeys,91)==true) {c='9';  };
 
 /* NEU */
                 if (BitTst(&theKeys,26)==true) {c='0';  };
                 if (BitTst(&theKeys,21)==true) {c='1';  };
                 if (BitTst(&theKeys,20)==true) {c='2';  };
                 if (BitTst(&theKeys,19)==true) {c='3';  };
                 if (BitTst(&theKeys,18)==true) {c='4';  };
                 if (BitTst(&theKeys,16)==true) {c='5';  };
                 if (BitTst(&theKeys,17)==true) {c='6';  };
                 if (BitTst(&theKeys,29)==true) {c='7';  };
                 if (BitTst(&theKeys,27)==true) {c='8';  };
                 if (BitTst(&theKeys,30)==true) {c='9';  };

                 


                /* BACKSPACE */
                dozgg=0;
                if (BitTst(&theKeys,52)==true)
                   
                        
                       {
                         { if (lx>0) { tame[lx]=' '; lx=lx-1; tame[lx]=' '; c=' '; dozgg=1; }
                 								 else { 
                                               if (nwi==2) { nwi=1; nz2=lx; lx=nz1;  timey=nx1;  wox=163+20; 
															 for (ii=0;ii<=10;++ii) codet[ii]=tame[ii];           
                                                             for (ii=0;ii<=10;++ii) tame[ii]=coden[ii];            
                                                             SndPlay(sndc0,click,TRUE);     	do ; while(SndChannelBusy(sndc0)==true);
                                                            };
                                               if (nwi==3) { nwi=2; nz3=lx; lx=nz2;   timey=nx2;  wox=163+20; 
															 for (ii=0;ii<=10;++ii) codel[ii]=tame[ii];           
                                                             for (ii=0;ii<=10;++ii) tame[ii]=codet[ii];            
                                                             SndPlay(sndc0,click,TRUE);     	do ; while(SndChannelBusy(sndc0)==true);
                                                            };

                                               }; };     };            								 
                 								 
                 								 
                 								 
                 								 
                 										
                 
              if ((c!=12) || (dozgg==1))
              { 
              if (lx<10) 
              { 
                dozg=0;
                tame[lx]=c;  // SOUND gestempfelt  


                if (dozgg==0) 
                  if (lx!=9) ++lx;

              for (i=0;i<=9;++i) {
                  SetPort((GrafPtr) bsack);              
                  SetRect(&ref,10,300,10+32,332);
                  
                  FillCRect(&ref,leerw);
                  
                ic0=GetCIcon((tame[i]-'A')+1061);    
                
                if ((tame[i]>'A'-1) && (tame[i]<('Z'+1))) ic0=GetCIcon((tame[i]-'A')+1061);    
                if ((tame[i]>'0'-1) && (tame[i]<('9'+1))) ic0=GetCIcon((tame[i]-'0')+2000);    

                  if (ic0!=0L) {
                         PlotCIcon(&ref,ic0); 
                  DisposeCIcon(ic0); };   
                              
                  /* UND NOCH DER WAHRE BUCHSTABEN DARAUF */
                  
                              
                  SetPort((GrafPtr) bsack);
                  SetRect(&re,10+i*25,300-25,10+25+i*25,300);
                  FillCRect(&re,leers); //else FillCRect(&re,leep);
                  CopyBits(&((GrafPtr) bsack)->portBits,&(((GrafPtr) bsack)->portBits),&ref,&re,36, 0L); };
                            
                     
                  
                    // zeichne NEU

                  i=9;
                 // timey=230;
                  SetRect(&re,10,300-25,10+25+i*25,300);
                  SetRect(&ri,wox+30,timey,wox+30+25+i*25,timey+25);
                  CopyBits(&((GrafPtr) bsack)->portBits,&(((GrafPtr) firstWin)->portBits),&re,&ri,srcCopy, 0L); 


                  SndPlay(sndc0,click,TRUE);               
                   do ; while(SndChannelBusy(sndc0)==true); 

                 };

                };
                              
               i=0; 


  /* ANTOHER CHEAT */
/* ---------------------> CHEAT ---------- */
   if (Button()==true)
    if (BitTst(&theKeys,54)==true)
      if (CHEAT==1)
      if  ((qq==0) && (q==0))  
      { // TEST
        checksum();
        
        
        bcore=senum;
       // score=123456789;  
        for (ii=0;ii<=8;++ii)
        { c=(char) (bcore%10);
          bcore=bcore/10;
          codel[ii]='0'+c;
 
        };
        
        nz3=10;
        wox=163+20;

              SetPort((GrafPtr) firstWin);        
              for (i=0;i<=8;++i) {
       

                  SetRect(&ref,10+i*25,10,10+25+i*25,35);
                  
                  FillCRect(&ref,leerw);
                if ((codel[i]>'A'-1) && (codel[i]<('Z'+1))) ic0=GetCIcon((codel[i]-'A')+1061);    
                if ((codel[i]>'0'-1) && (codel[i]<('9'+1))) ic0=GetCIcon((codel[i]-'0')+2000);    

                  if (ic0!=0L) {
                         PlotCIcon(&ref,ic0); 
                  DisposeCIcon(ic0); };   
            
                 };
  

        
      
      };
                      														    
  /* AM ENDE */
        
        i=0;
       
       if (Button()==true)
        if  ((qq>358) && (qq<395))
        if (q>163)
        { if ((q<(163+92)) || (BitTst(&theKeys,50)==true)) i=1;
          if (((q>(283+163)) && (q<(163+336))) ) { i=2;
                      
                      if (nwi==3) {  for (ii=0;ii<=10;++ii) codel[ii]=tame[ii]; };
                      if (nwi==2) {  for (ii=0;ii<=10;++ii) codet[ii]=tame[ii]; };
                      if (nwi==1) {  for (ii=0;ii<=10;++ii) coden[ii]=tame[ii]; };

                                              };  
        } 
         
        if (((BitTst(&theKeys,35)==true)  ||  (BitTst(&theKeys,122)==true))){ 
        
                                         SndPlay(sndc0,click,TRUE);               
                                         do ; while(SndChannelBusy(sndc0)==true); 
        
					                           if (nwi==3) {  for (ii=0;ii<=10;++ii) codel[ii]=tame[ii];  i=2; };
					                             
                                               if (nwi==2) { nwi=3; nz2=lx; lx=nz3;  timey=nx3;  wox=163+20; 
															 for (ii=0;ii<=10;++ii) codet[ii]=tame[ii];           
                                                             for (ii=0;ii<=10;++ii) tame[ii]=codel[ii];            
                                                            };
                                               if (nwi==1) { nwi=2; nz1=lx; lx=nz2;  timey=nx2;   wox=163+20; 
															 for (ii=0;ii<=10;++ii) coden[ii]=tame[ii];           
                                                             for (ii=0;ii<=10;++ii) tame[ii]=codet[ii];                                                           
                                               }; 
                                        };
              
        
    }
 while (i==0);   

                      SndPlay(sndc1,click,TRUE);
                      do ; while(SndChannelBusy(sndc1)==true); 
   VERSION=0;

 
   
   if (i==2) {

       checksum();
       bcore=senum;      
        i=1;
        for (ii=0;ii<=8;++ii)
        { c=(char) (bcore%10);
          bcore=bcore/10;
         if (codel[ii]!=('0'+c)) i=0;
        };
        
        if (i==1) { VERSION=1;     SndPlay(sndc1,begin,TRUE); // do ; while(SndChannelBusy(sndc0)==true); 
   
                                                  GetVol(NULL,&reply.vRefNum);
                                                  Create("\pSCOT", reply.vRefNum,'NIXT',reply.fType);

                                                   FSOpen("\pSCOT",reply.vRefNum,&refnum);

                                                   bietes=sizeof(long)*11 ;
                                                   FSWrite(refnum,&bietes,&sc[0]); // ANDERES !!

                                                   bietes=sizeof(char)*11*10 ;
                                                   FSWrite(refnum,&bietes,&nm[0][0]); // ANDERES !!

                                                   bietes=sizeof(int)*11 ;
                                                   FSWrite(refnum,&bietes,&lv[0]); // ANDERES !!

 /* REGISTRATION */


                                                   bietes=sizeof(char)*11;
                                                   FSWrite(refnum,&bietes,&coden[0]); // ANDERES !!

                                                   bietes=sizeof(char)*11;
                                                   FSWrite(refnum,&bietes,&codet[0]); // ANDERES !!

                                                   bietes=sizeof(char)*11;
                                                   FSWrite(refnum,&bietes,&codel[0]); // ANDERES !!

                                                   bietes=sizeof(int);;
                                                   FSWrite(refnum,&bietes,&speed); // ANDERES !!

                                                   FSClose(refnum);
      
   
   
   } else
   { VERSION=0;     SndPlay(sndc1,bye,TRUE);   };  

    //ein Ton dazu
    
    
   };

     
   
              
                  
              
                 //gemenu=2; // oder so !!
                            
              